package com.jaiai.work.work.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.jaiai.work.work.entity.TWork;
import com.jaiai.work.work.mapper.TWorkMapper;
import com.jaiai.work.work.service.ITWorkService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jaiai.work.work.vo.WorkSearch;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 工作日志 服务实现类
 * </p>
 *
 * @author 佳爱网络科技
 * @since 2018-04-20
 */
@Service
public class TWorkServiceImpl extends ServiceImpl<TWorkMapper, TWork> implements ITWorkService {

    @Override
    public Page<TWork> list(WorkSearch search) {
        EntityWrapper wrapper=new EntityWrapper();
        if(StringUtils.isEmpty(search.getUID())){
             wrapper.eq("u_id",search.getUID());
        }
        Page page=new Page();
        page.setCurrent(search.getPage());
        page.setSize(search.getSize()==null?30:search.getSize());
        page.setRecords(baseMapper.selectPage(page,wrapper));
        return page;
    }
}
